- Writing classes

Driver class ---> client program that has the main method
Helper class (Service provider) ---> fields + constructor + methods

If we don't provide our own constructor method ===> Java creates a default constructor
public Die() {

}
Default constructor: 0 parameters + empty body ==> Java creates only if you don't provide your
own

- Instance variables + scope of a variable
- Visibility modifiers (public, private, protected)

- Formal parameters + actual parameters (lifecycle of a parameter)
- Calling and called methods

Location where you declare the variable defines the scope of the variable
faceValue: declared inside the class but not inside any method
===> scope of this variable is the entire class
Scope: area in the code where we can use/reference the variable by name

value: declared inside a method ===> local variable for the method
value as a variable can only be used inside the body of the method


Lifcycle of the variable. When does Java create faceValue? When does Java create value?

A faceValue is created the instant a Die object is created ===> # copies of the variable = 
# of instances/objects created

Die die1 = new Die(); // faceValue = 6
Die die2 = new Die(); // faceValue = 6

value? The minute you call the method that owns it (setFaceValue)
die1.setFaceValue(6); // value = 6

The minute we exit the body of the setFaceValue method ===> value is destroyed

In this implementation, faceValue is destroyed the minute we exit the main method


- Visibility modifier (public, private, protected)
Encapsulation
Rule of thumb: 

Variables/state descriptors: are declared with private visibility

It can be used anywhere inside the class but cannot be used from outside of the class


Methods: are public

Getter methods are created to enable the client program to access the private variable ===>
Accessor methods

Setter methods enables the client program to change the vlaue of the private variable ===> 
Mutator methods


this.faceValue ---> instance variable

- Formal parameters and actual parameters
formal parameter: is the parameter you provide when creating the method

public void setFaceValue(int value) { // value is the formal parameter

}

actual parameter?
The value you submit to the method when you use/call/invoke the method

die1.setFaceValue(6); // 6 is the actual parameter

- Calling and called methods?

main: calling method ---> getFaceValue: called method
If the calling method and the called method are defined in two different classes ---> 
We have to invoke the called method through an object


roll: calling method ---> generateRndValue: called method

If the calling and called methods are defined inside the same ==> 
Only the name of the called method is needed to use it. 




























